blob: 5bb42fa49da3f6a783bd6c8cdbd163d5ce9ccb8f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { get, auth, post } from "$lib/utils";
import { redirect } from "@sveltejs/kit";
export async function load({ cookies, params, parent }) {
const { user } = await parent();
const { id } = params;
const { amount } = await get(`/fund/${id}`);
if (!amount) redirect(307, `/fund/${id}`);
if (!user) redirect(307, `/register?redirect=/fund/${id}/sweep`);
await post("/take", { amount, id }, auth(cookies));
return { amount, id };
}
|